package com.tcm.service;

import com.baomidou.mybatisplus.extension.service.IService;
import com.tcm.entity.Book;
import com.tcm.entity.BookItem;
import com.tcm.entity.dto.BookUpdateDto;
import com.tcm.entity.vo.BookChapterStuListResult;
import com.tcm.entity.vo.BookListResult;
import com.tcm.entity.vo.BookVolumeStuListResult;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.multipart.MultipartFile;

import java.util.List;
import java.util.Map;

/**
 * @author Guqier
 * @version 1.0
 * @date 2023/7/2 17:16
 */
public interface BookService extends IService<Book> {

    @Transactional
    boolean addCourseInfo(String name, Integer sequence, MultipartFile file, Long currUserId) throws Exception;

    @Transactional
    boolean removeCourseInfo(Long id, Long currUserId) throws Exception;

    List<BookListResult> getCourseList();

    @Transactional
    boolean modifyCourseInfo(Long id, String name, Integer sequence, MultipartFile file, Long currUserId) throws Exception;

    List<Book> findChildNode(Long bookId, List<Book> list);

    @Transactional
    boolean addBookNode(BookUpdateDto bookUpdateDto, Long currUserId);

    List<BookListResult> getBookNodes(Long parentId);

    @Transactional
    boolean modifyBookNodeInfo(BookUpdateDto bookUpdateDto, Long currUserId);

    @Transactional
    boolean removeBookNode(Long id, Long currUserId);

    Book getCourseByBookNodeId(Long bookId, List<Book> books);

    List<BookListResult> getBookNodesWithoutItemNum(Long parentId);

    void getBookAllParentNodesIdByRecursion(Long currBookId, List<Book> books, List<Book> parents);

    Map<String, String> setBookNodeCoverImage(Long bookId, MultipartFile file, Long currUserId) throws Exception;

    List<List<BookListResult>> getBooksOfItem(Long itemId, List<BookItem> bookItems, List<Book> books);

    List<BookListResult> getStuCourse(Long currUserId);

    List<BookVolumeStuListResult> getStuVolume(Long courseId);

    List<BookChapterStuListResult> getStuChapter(Long volumeId, Long currUserId);

    List<Book> getBookList();

    List<Book> getChildBooks(Long parentId);
}
